// Package day_02_mid_sort 75_
// @Title day_02_mid_sort
// @Description
// @Author  == 琳琳也叫王木木 ==  2021/9/4 13:50
// @Create  2021/9/4 13:50
package day_02_mid_sort

import "fmt"

func PartitionArr(nums []int, tag int) {
	if nums == nil || len(nums) < 1 {
		return
	}
	L, R := 0, len(nums)-1
	for i := 0; i <= R; i++ {
		if nums[i] < tag {
			nums[i], nums[L] = nums[L], nums[i]
			L++
		} else if nums[i] > tag {
			nums[i], nums[R] = nums[R], nums[i]
			R--
			if nums[i] != tag {
				i--
			}
		}
	}
	fmt.Println(nums)
}
